<template>
  <!-- 推荐歌单 音乐卡片 -->
  <div class="music-card-wraper clearfix">
    <div class="music-card" v-for="item in recommend" :key="item.id">
      <div class="mask">
        <div>播放量：{{item.playCount}}</div>
      </div>
      <img :src="item.coverImgUrl" alt="">
      <h4 class="music-list-name">{{item.name}}</h4>
      <div class="icon-wrap"><span class="iconfont iconbofang1"></span></div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    recommend: {
      type: Array,
      default() {
        return []
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.music-card-wraper {
  display: flex;
  flex-wrap: wrap;
  width: 110%;
  padding-left: 10px;
  overflow: hidden;
  .music-card {
    position: relative;
    width: 200px;
    margin: 0 20px 20px 0;
    cursor: pointer;
    overflow: hidden;
    img {
      width: 100%;
      border-radius: 10px;
    }
    h4 {
      margin-top: 8px;
      font-size: 14px;
      font-weight: 500;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .mask {
      position: absolute;
      box-sizing: border-box;
      top: -50px;
      width: 100%;
      max-height: 50px;
      padding: 5px;
      color: #fff;
      font-size: 16px;
      background-color: rgba(0, 0, 0, 0.5);
      transition: top 0.7s;
      div {
        overflow: hiddern;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
      }
    }
    .icon-wrap {
      position: absolute;
      right: 10px;
      bottom: 30px;
      width: 40px;
      height: 40px;
      line-height: 40px;
      border-radius: 50%;
      text-align: center;
      background-color: #fff;
      opacity: 0;
      transition: opacity 0.7s;
      .iconbofang1 {
        position: relative;
        left: 2px;
        font-size: 18px;
        color: #dd6d60;
      }
    }
    &:hover {
      .mask {
        top: 0;
        // transition: all 0.5s; // 可省略
      }
      .icon-wrap {
        opacity: 0.8;
        // transition: all 0.5s; // 可省略
      }
    }
  }
}
</style>